GtkModelButton: Remove some margins
authorTimm Bäder <mail@baedert.org>
Thu, 7 Jan 2016 17:27:11 +0000 (18:27 +0100)
committerTimm Bäder <mail@baedert.org>
Thu, 7 Jan 2016 18:37:18 +0000 (19:37 +0100)
Now that we can use margins from css for this, remove the margins we set
in code and use css instead.

gtk/gtkmenusectionbox.c
gtk/gtkmodelbutton.c
gtk/theme/Adwaita/_common.scss
gtk/theme/Adwaita/gtk-contained-dark.css
gtk/theme/Adwaita/gtk-contained.css

index 0557bc9e2b57c511e211acc1e515002925e2d8fc..2de27dab0b5ac5465d282c2525c8c6963e7b43ff 100644 (file)
@@ -496,12 +496,6 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
       box->separator = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
       g_object_ref_sink (box->separator);
 
-      g_object_set (box->separator,
-                    "margin-start", 12,
-                    "margin-end", 12,
-                    "margin-top", 6,
-                    "margin-bottom", 3,
-                    NULL);
       gtk_container_add (GTK_CONTAINER (box->separator), title);
       gtk_container_add (GTK_CONTAINER (box->separator), separator);
       gtk_widget_show_all (box->separator);
@@ -511,12 +505,6 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
       box->separator = separator;
       g_object_ref_sink (box->separator);
 
-      g_object_set (box->separator,
-                    "margin-start", 12,
-                    "margin-end", 12,
-                    "margin-top", 3,
-                    "margin-bottom", 3,
-                    NULL);
       gtk_widget_show (box->separator);
     }
 
index 50db41480b7a4b8ad63018fddf6b4d7f0c055b78..adeac69c6a41275c94030c4784f72b92ea2f630d 100644 (file)
@@ -1209,15 +1209,10 @@ gtk_model_button_init (GtkModelButton *button)
   button->role = GTK_BUTTON_ROLE_NORMAL;
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   button->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_widget_set_margin_start (button->box, 12);
-  gtk_widget_set_margin_end (button->box, 12);
-  gtk_widget_set_margin_top (button->box, 3);
-  gtk_widget_set_margin_bottom (button->box, 3);
   gtk_widget_set_halign (button->box, GTK_ALIGN_FILL);
   gtk_widget_show (button->box);
   button->image = gtk_image_new ();
   gtk_widget_set_no_show_all (button->image, TRUE);
-  g_object_set (button->image, "margin", 4, NULL);
   button->label = gtk_label_new ("");
   gtk_widget_set_no_show_all (button->label, TRUE);
   gtk_container_add (GTK_CONTAINER (button->box), button->image);
index 74db83403698f82c7c952f9158b566c10001683f..d408f5c45a9d0504266d9a577d172a553a4add5c 100644 (file)
@@ -728,13 +728,25 @@ toolbar.inline-toolbar toolbutton:backdrop {
 /* menu buttons */
 modelbutton.flat,
 .menuitem.button.flat {
+  min-height: 26px;
+  padding-left: 5px;
+  padding-right: 5px;
+  border-radius: 3px;
+  outline-offset: -2px;
+
   @extend %undecorated_button;
-  outline-offset: -1px;
   &:hover { background-color: mix($fg_color, $bg_color, 10%); }
   &:selected { @extend %selected_items; }
   &:backdrop, &:backdrop:hover {
     @extend %undecorated_button;
   }
+
+  // FIXME: remove the following when the checks/radios rewrite lands
+  check:last-child,
+  radio:last-child { margin-left: 8px; }
+
+  check:first-child,
+  radio:first-child { margin-right: 8px; }
 }
 
 modelbutton.flat arrow {
@@ -1630,10 +1642,6 @@ popover.background {
     transition: none;
   }
 
-  button.model.image-button {
-    padding: 0px;
-  }
-
   .csd &, & {
     &.touch-selection,
     &.magnifier {
@@ -1644,6 +1652,8 @@ popover.background {
 
     &.osd { @extend %osd; }
   }
+
+  separator { margin: 3px; }
 }
 
 /*************
index a1059482318cd1f67444fd300d8b0032014f0a50..4878937b5301fca26bc409e64cf206a62ff1c7f5 100644 (file)
@@ -1227,10 +1227,24 @@ notebook tab .titlebar button.titlebutton,
 /* menu buttons */
 modelbutton.flat,
 .menuitem.button.flat {
-  outline-offset: -1px; }
+  min-height: 26px;
+  padding-left: 5px;
+  padding-right: 5px;
+  border-radius: 3px;
+  outline-offset: -2px; }
   modelbutton.flat:hover,
   .menuitem.button.flat:hover {
     background-color: #4b5150; }
+  modelbutton.flat check:last-child,
+  modelbutton.flat radio:last-child,
+  .menuitem.button.flat check:last-child,
+  .menuitem.button.flat radio:last-child {
+    margin-left: 8px; }
+  modelbutton.flat check:first-child,
+  modelbutton.flat radio:first-child,
+  .menuitem.button.flat check:first-child,
+  .menuitem.button.flat radio:first-child {
+    margin-right: 8px; }
 
 modelbutton.flat arrow {
   background: none; }
@@ -2216,12 +2230,10 @@ popover.background {
   .titlebar popover.background button.titlebutton:hover {
     text-shadow: none;
     transition: none; }
-  popover.background button.model.image-button, popover.background headerbar button.model.titlebutton, headerbar popover.background button.model.titlebutton,
-  popover.background .titlebar button.model.titlebutton,
-  .titlebar popover.background button.model.titlebutton {
-    padding: 0px; }
   .csd popover.background.touch-selection, .csd popover.background.magnifier, popover.background.touch-selection, popover.background.magnifier {
     border: 1px solid rgba(255, 255, 255, 0.1); }
+  popover.background separator {
+    margin: 3px; }
 
 /*************
  * Notebooks *
index b2b23024b660ef1a164efad904264e37d8d651d7..c075f6c8686f51d77316f4f33dc9d97ccc3a3363 100644 (file)
@@ -1227,10 +1227,24 @@ notebook tab .titlebar button.titlebutton,
 /* menu buttons */
 modelbutton.flat,
 .menuitem.button.flat {
-  outline-offset: -1px; }
+  min-height: 26px;
+  padding-left: 5px;
+  padding-right: 5px;
+  border-radius: 3px;
+  outline-offset: -2px; }
   modelbutton.flat:hover,
   .menuitem.button.flat:hover {
     background-color: #d5d6d5; }
+  modelbutton.flat check:last-child,
+  modelbutton.flat radio:last-child,
+  .menuitem.button.flat check:last-child,
+  .menuitem.button.flat radio:last-child {
+    margin-left: 8px; }
+  modelbutton.flat check:first-child,
+  modelbutton.flat radio:first-child,
+  .menuitem.button.flat check:first-child,
+  .menuitem.button.flat radio:first-child {
+    margin-right: 8px; }
 
 modelbutton.flat arrow {
   background: none; }
@@ -2222,12 +2236,10 @@ popover.background {
   .titlebar popover.background button.titlebutton:hover {
     text-shadow: none;
     transition: none; }
-  popover.background button.model.image-button, popover.background headerbar button.model.titlebutton, headerbar popover.background button.model.titlebutton,
-  popover.background .titlebar button.model.titlebutton,
-  .titlebar popover.background button.model.titlebutton {
-    padding: 0px; }
   .csd popover.background.touch-selection, .csd popover.background.magnifier, popover.background.touch-selection, popover.background.magnifier {
     border: 1px solid rgba(255, 255, 255, 0.1); }
+  popover.background separator {
+    margin: 3px; }
 
 /*************
  * Notebooks *